package cn.uc.app;

import cn.uc.bs.ContentObject;
import cn.uc.component.ContentItem;
import cn.uc.grapics.BitmapItem;
import cn.uc.grapics.GraphicsView;
import cn.uc.grapics.Scene;
import cn.uc.grapics.TextItem;
import cn.uc.util.ImageUtil;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.PointF;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class GraphicsActivity extends Activity{
    private GraphicsView view;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        view = new GraphicsView(this);
        setContentView(view);
        
        Scene aScene = new Scene(view);
        view.setScene(aScene);
        
        TextItem sItem1 = new TextItem("This is a test");
        aScene.addItem(sItem1);
        sItem1.setPos(10,20);       
        
        Bitmap sBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.child_image);
        BitmapItem sItem2 = new BitmapItem(sBitmap);
        aScene.addItem(sItem2);
        sItem2.setPos(20, 40);
        sItem2.setAngle(45);
        
        Bitmap sBitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.user_group);
        BitmapItem sItem4 = new BitmapItem(sBitmap2);
        aScene.addItem(sItem4);
        sItem4.setPos(120, 40);
        
        ContentObject sObject = new ContentObject("1");
        Bitmap sBitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.image);//ImageUtil.zoomBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.image), 320, 240);
        sObject.setBitmap(sBitmap1);
        sObject.setAngle(45);
//        sObject.setScaleRatios(new PointF());
//        sObject.setPos(new Point(20,80));
        ContentItem sItem3 = new ContentItem(sObject);
        sItem3.setFocus(true);
        aScene.addItem(sItem3);
        sItem3.setPos(20,80);
        sItem3.setScaleRatio(0.5f, 0.5f);
    }

}
